import { request } from '@/service/request';
import type { Developer, DictDataVo } from '@/service/types/developer';

// 根据字典类型查询字典数据信息
export function getDicts(dictType: string) {
  return request<Developer.DictDataVO>({
    url: `/system/dict/data/type/${dictType}`,
    method: 'get'
  });
}
export function getPageList(params: any) {
  return request<Developer.DictDataVO>({
    url: '/system/dict/data/list',
    method: 'get',
    params
  });
}

export function getDictData(id: number) {
  return request<DictDataVo>({
    url: `/system/dict/data/${id}`,
    method: 'get'
  });
}

export function addDictData(data: DictDataVo) {
  return request({
    url: '/system/dict/data',
    method: 'post',
    data
  });
}

export function editDictData(data: DictDataVo) {
  return request({
    url: '/system/dict/data',
    method: 'put',
    data
  });
}

export function delDictData(id: number | number[]) {
  return request({
    url: `/system/dict/data/${id}`,
    method: 'DELETE'
  });
}
